package com.lct.demo;

import java.util.Random;
import java.util.Scanner;

public class Test6 {
    public static void main(String[] args) {
        /**
         * 抢红包：9、666、188、520、88888一共五个红包，先到先得抽完为止，一个包只能一次
         */
        redbag();

    }

    public static void redbag(){
        Random r = new Random();
        Scanner sc = new Scanner(System.in);
        int[] redbag = {9,666,188,520,8888};
        for (int i = 0; i < redbag.length; i++) {
            System.out.println("请" + (i + 1) + "号粉丝抽奖");
            sc.next();

            while (true) {
                int index = r.nextInt(redbag.length);
                int money = redbag[index];

                if (money != 0){
                    System.out.println("恭喜你中奖了" + money + "元");
                    redbag[index] = 0;
                    break;
                }
            }
        }



    }
}
